package main

import "fmt"

func main() {
	s := make([]int, 3, 5)
	ss := s[2:]
	fmt.Println(len(s), cap(s), len(ss), cap(ss))
	//var s1 []int
	s1 := []int{}
	//s1 := make([]int, 1, 2)
	//fmt.Println(s1[0])
	s1 = append(s1, 0)
	fmt.Println(s1[0])
	//a := [...]int{1, 2, 3, 4, 5,6,7,8}
	//s := a[1:6]
	///**
	//s{2,3,4,5,6}
	//len=6-1=5
	//cap=max-1=8-1=7
	// */
	//fmt.Printf("s:%v len(s):%v cap(s):%v\n", s, len(s), cap(s))
	///**
	//s{7,8}
	//len=7-5=2
	////max=7(默认容量)
	//cap=7-5=2
	//*/
	//s2 := s[5:7]  // 索引的上限是cap(s)而不是len(s)
	//fmt.Printf("s2:%v len(s2):%v cap(s2):%v\n", s2, len(s2), cap(s2))
}
